<?php
/**
 * CMultiForm[未完成]
 * @package lib.widgets
 */
class CMultiForm extends CWidget {
	
	public $formId;
	public $form;
	public $name;
	public $model;
	public $embedId;
	public $templateId;
	public $itemClass;
	public $addButtons = array();
	public $removeButtonClass;

	public function run() {
		$am = Yii::app()->assetManager;
		$cs = Yii::app()->clientScript;

		$url = $am->publish(dirname(__FILE__).'/js/jquery.multiform.js');
		$cs->registerScriptFile($url);
		
		$hiddenName = get_class($this->model)."[_DELETED_][{$this->name}][]";
		
		$script = "
			jQuery.multiform({
				'embedId': '{$this->embedId}',
				'templateId': '{$this->templateId}',
				'addButtons': ['".implode("', '", $this->addButtons)."'],
				'removeButtonClass': '{$this->removeButtonClass}',
				'formId': '{$this->formId}',
				'itemClass': '{$this->itemClass}',
				'hiddenName': '{$hiddenName}'
			});
		";
		
		$cs->registerScript('noname', $script);
		
	}
	

}

?>